####################################################  INFORMATIONS ####################################################
Nom / Name : Un message par sujet / One post per topic
Version : 1.0.0-dev
Compatible :  phpBB 3.2.x
Author : John McKenzie (john010117.2)
Package author : Galixte (http://www.galixte.com)
Sujet officiel / Official topic : http://www.ezcom-fr.com/viewtopic.php?f=11&t=1012

Liens des sources du code / Source code links :
https://www.phpbb.com/community/viewtopic.php?f=70&t=1056225

######################################### JOURNAL DES CHANGEMENTS / CHANGELOG #####################################

Version 0.0.3 (2008.07.13) :
- Added support for per-forum basis.

Version 1.1.0-dev (2019.06.11) :
- adaptation pour les fichiers de phpBB 3.2.x / Adaptation for phpBB 3.2.x files.

####################################################  INSTRUCTIONS ####################################################

>>> Exécuter les requêtes SQL suivantes / Execute the SQL queries :

ALTER TABLE `phpbb_topics` ADD `topic_onepost` TINYINT( 1 ) NOT NULL DEFAULT '0';
ALTER TABLE `phpbb_forums` ADD `enable_onepost` TINYINT( 1 ) NOT NULL DEFAULT '0';

>>> Liste des fichiers modifiés / modified files list :

./adm/style/acp_forums.html
./includes/acp/acp_forums.php
./includes/functions_posting.php
./language/en/posting.php
./language/en/acp/forums.php
./language/fr/posting.php
./language/fr/acp/forums.php
./styles/prosilver/template/posting_editor.html
./posting.php

##########################

OUVRIR / OPEN :

./adm/style/acp_forums.html

##########################

TROUVER / FIND :

		<dl>
			<dt><label for="enable_icons">{L_ENABLE_TOPIC_ICONS}{L_COLON}</label></dt>
			<dd><label><input type="radio" class="radio" name="enable_icons" value="1"<!-- IF S_TOPIC_ICONS --> id="enable_icons" checked="checked"<!-- ENDIF --> /> {L_YES}</label>
				<label><input type="radio" class="radio" name="enable_icons" value="0"<!-- IF not S_TOPIC_ICONS --> id="enable_icons" checked="checked"<!-- ENDIF --> /> {L_NO}</label></dd>
		</dl>

##########################

AJOUTER, APRÈS / ADD, AFTER :

		<dl>
			<dt><label for="enable_onepost">{L_ENABLE_ONEPOST}{L_COLON}</label><br /><span>{L_ENABLE_ONEPOST_EXPLAIN}</span></dt>
			<dd><label><input type="radio" class="radio" name="enable_onepost" value="1"<!-- IF S_ENABLE_ONEPOST --> id="enable_onepost" checked="checked"<!-- ENDIF --> /> {L_YES}</label>
				<label><input type="radio" class="radio" name="enable_onepost" value="0"<!-- IF not S_ENABLE_ONEPOST --> id="enable_onepost" checked="checked"<!-- ENDIF --> /> {L_NO}</label></dd>
		</dl>

##########################

OUVRIR / OPEN :

./includes/acp/acp_forums.php

##########################

TROUVER / FIND :

						'forum_password_unset'	=> $request->variable('forum_password_unset', false),

##########################

AJOUTER, APRÈS / ADD, AFTER :

						'enable_onepost'		=> $request->variable('enable_onepost', false),

##########################

TROUVER / FIND :

							'forum_password_confirm'=> '',

##########################

AJOUTER, APRÈS / ADD, AFTER :

							'enable_onepost'		=> false,

##########################

TROUVER / FIND :

					'S_PRUNE_ENABLE'			=> ($forum_data['enable_prune']) ? true : false,

##########################

AJOUTER, APRÈS / ADD, AFTER :

					'S_ENABLE_ONEPOST'			=> ($forum_data['enable_onepost'] && $forum_data['forum_type'] == FORUM_POST) ? true : false,

##########################

TROUVER / FIND :

		// Unset data that are not database fields
		$forum_data_sql = $forum_data_ary;

		unset($forum_data_sql['forum_link_track']);
		unset($forum_data_sql['prune_old_polls']);
		unset($forum_data_sql['prune_announce']);
		unset($forum_data_sql['prune_sticky']);
		unset($forum_data_sql['show_active']);
		unset($forum_data_sql['enable_post_review']);
		unset($forum_data_sql['enable_quick_reply']);
		unset($forum_data_sql['forum_password_confirm']);

##########################

AJOUTER, APRÈS / ADD, AFTER :


		// One post per topic MOD - START
		// Just to be on the safe side - unset the onepost field if the forum we're creating/updating is a category
		if($forum_data_sql['forum_type'] !== FORUM_POST)
		{
			unset($forum_data_sql['enable_onepost']);
		}
		// One post per topic MOD - END

##########################

OUVRIR / OPEN :

./includes/functions_posting.php

##########################

TROUVER / FIND :

				'topic_attachment'			=> (!empty($data_ary['attachment_data'])) ? 1 : 0,

##########################

AJOUTER, APRÈS / ADD, AFTER :

				'topic_onepost'				=> $data_ary['topic_onepost'],

##########################

TROUVER / FIND :

			$sql_data[TOPICS_TABLE]['sql'] = array(
				'forum_id'					=> $data_ary['forum_id'],
				'icon_id'					=> $data_ary['icon_id'],
				'topic_title'				=> $subject,
				'topic_first_poster_name'	=> $username,
				'topic_type'				=> $topic_type,
				'topic_time_limit'			=> $topic_type != POST_NORMAL ? ($data_ary['topic_time_limit'] * 86400) : 0,
				'poll_title'				=> (isset($poll_ary['poll_options'])) ? $poll_ary['poll_title'] : '',
				'poll_start'				=> (isset($poll_ary['poll_options'])) ? $poll_start : 0,
				'poll_max_options'			=> (isset($poll_ary['poll_options'])) ? $poll_ary['poll_max_options'] : 1,
				'poll_length'				=> (isset($poll_ary['poll_options'])) ? $poll_length : 0,
				'poll_vote_change'			=> (isset($poll_ary['poll_vote_change'])) ? $poll_ary['poll_vote_change'] : 0,
				'topic_last_view_time'		=> $current_time,

				'topic_attachment'			=> (!empty($data_ary['attachment_data'])) ? 1 : (isset($data_ary['topic_attachment']) ? $data_ary['topic_attachment'] : 0),

##########################

AJOUTER, APRÈS / ADD, AFTER :

				'topic_onepost'				=> $data_ary['topic_onepost'],

##########################

OUVRIR / OPEN :

./language/en/acp/forums.php


##########################

TROUVER / FIND :

	'ENABLE_TOPIC_ICONS'			=> 'Enable topic icons',

##########################

AJOUTER, APRÈS / ADD, AFTER :

	'ENABLE_ONEPOST'				=> 'Enable one post (per user) per topic',
	'ENABLE_ONEPOST_EXPLAIN'		=> 'If set to yes users will have the ability to allow only one post per user while creating a topic within that topic.',

##########################

OUVRIR / OPEN :

./language/en/posting.php

##########################

TROUVER / FIND :

	'NO_POST_MODE'				=> 'No post mode specified.',

##########################

AJOUTER, APRÈS / ADD, AFTER :

	'ONE_POST'					=> 'Only allow one post per user',

##########################

TROUVER / FIND :

	'TOPIC_BUMPED'				=> 'Topic has been bumped successfully.',

##########################

AJOUTER, APRÈS / ADD, AFTER :

	'TOPIC_ONEPOST'				=> 'You are only allowed to post in this topic once.',

##########################

OUVRIR / OPEN :

./language/fr/acp/forums.php

##########################

TROUVER / FIND :

	'ENABLE_TOPIC_ICONS'			=> 'Activer les icônes des sujets',

##########################

AJOUTER, APRÈS / ADD, AFTER :

	'ENABLE_ONEPOST'				=> 'Activer la limite d’un message par sujet et par utilisateur',
	'ENABLE_ONEPOST_EXPLAIN'		=> 'Permet aux utilisateurs publiant un sujet de limiter les utilisateurs à une seule réponse (message).',

##########################

OUVRIR / OPEN :

./language/fr/posting.php

##########################

TROUVER / FIND :

	'NO_POST_MODE'				=> 'Aucun type de message n’est indiqué.',

##########################

AJOUTER, APRÈS / ADD, AFTER :

	'ONE_POST'					=> 'Autoriser seulement une réponse (message) par utilisateur',

##########################

TROUVER / FIND :

	'TOPIC_BUMPED'				=> 'Le sujet a été remonté.',

##########################

AJOUTER, APRÈS / ADD, AFTER :

	'TOPIC_ONEPOST'				=> 'Vous êtes autorisé à publier qu’un seul message dans ce sujet.',

##########################

OUVRIR / OPEN :

./styles/prosilver/template/posting_editor.html

##########################

TROUVER / FIND :

			<!-- IF S_NOTIFY_ALLOWED -->
				<div><label for="notify"><input type="checkbox" name="notify" id="notify"{S_NOTIFY_CHECKED} /> {L_NOTIFY_REPLY}</label></div>
			<!-- ENDIF -->

##########################

AJOUTER, APRÈS / ADD, AFTER :

			<!-- IF S_NEW_EDIT_TOPIC and S_SHOW_ONEPOST -->
				<div><label for="one_post"><input type="checkbox" name="one_post" id="one_post"{S_ONEPOST_CHECKED} /> {L_ONE_POST}</label></div>
			<!-- ENDIF -->

##########################

OUVRIR / OPEN :

./posting.php

##########################

TROUVER / FIND :

// Is the user able to read within this forum?
if (!$auth->acl_get('f_read', $forum_id))
{
	if ($user->data['user_id'] != ANONYMOUS)
	{
		trigger_error('USER_CANNOT_READ');
	}
	$message = $user->lang['LOGIN_EXPLAIN_POST'];

	if ($request->is_ajax())
	{
		$json = new phpbb\json_response();
		$json->send(array(
			'title'		=> $user->lang['INFORMATION'],
			'message'	=> $message,
		));
	}

	login_box('', $message);
}

##########################

AJOUTER, APRÈS / ADD, AFTER :

// One post per topic - START
if (($mode == 'reply' || $mode == 'quote') && $post_data['topic_onepost'] && $post_data['enable_onepost'] && !$auth->acl_get('a_', $forum_id) && !$auth->acl_get('m_', $forum_id))
{
	$sql = 'SELECT post_id
				FROM ' . POSTS_TABLE . '
				WHERE topic_id = ' . $topic_id . '
					AND poster_id = ' . $user->data['user_id'];
	$result = $db->sql_query($sql);
	$row = $db->sql_fetchrow($result);
	$db->sql_freeresult($result);

	if ($row)
	{
		trigger_error('TOPIC_ONEPOST');
	}
	unset($row);
}
$post_data['one_post'] = (($mode == 'post' || ($mode == 'edit' && $post_id == $post_data['topic_first_post_id'])) && $post_data['topic_onepost'] && $post_data['enable_onepost']) ? true : false;
// One post per topic - END


##########################

TROUVER / FIND :

	$post_data['enable_sig']		= (!$config['allow_sig'] || !$auth->acl_get('f_sigs', $forum_id) || !$auth->acl_get('u_sig')) ? false : ((isset($_POST['attach_sig']) && $user->data['is_registered']) ? true : false);

##########################

AJOUTER, APRÈS / ADD, AFTER :

	if ($post_data['one_post'] === true)
	{
		if (!isset($_POST['one_post']))
		{
			$post_data['one_post'] = false;
		}
	}
	else
	{
		if(isset($_POST['one_post']) && $post_data['enable_onepost'])
		{
			$post_data['one_post'] = true;
		}
	}

##########################

TROUVER / FIND :

				'enable_sig'			=> (bool) $post_data['enable_sig'],
				
##########################

AJOUTER, APRÈS / ADD, AFTER :

				'topic_onepost'			=> (bool) $post_data['one_post'],


##########################

TROUVER / FIND :

$sig_checked		= $post_data['enable_sig'];

##########################

AJOUTER, APRÈS / ADD, AFTER :

$onepost_checked	= $post_data['one_post'];

##########################

TROUVER / FIND :

	'S_PRIVMSGS'				=> false,

##########################

AJOUTER, APRÈS / ADD, AFTER :

	'S_NEW_EDIT_TOPIC'			=> ($mode == 'post' || ($mode == 'edit' && $post_id == $post_data['topic_first_post_id'])) ? true : false,
	'S_SHOW_ONEPOST'			=> ($post_data['enable_onepost']) ? true : false,

##########################

TROUVER / FIND :

	'S_SIGNATURE_CHECKED'		=> ($sig_checked) ? ' checked="checked"' : '',

##########################

AJOUTER, APRÈS / ADD, AFTER :

	'S_ONEPOST_CHECKED'			=> ($onepost_checked) ? ' checked="checked"' : '',

##########################

PURGER le cache du forum / PURGE the board cache.

#################################################### FIN / EOM ####################################################